import request from '@/config/axios'

// 院校 VO
export interface SchoolVO {
  id: number // 主键id
  name: string // 名称
  province: string // 省份
  provinceName?: string // 省份名称
  sort: number // 排序
}

// 院校 API
export const SchoolApi = {
  // 查询院校分页
  getSchoolPage: async (params: any) => {
    return await request.get({ url: `/kf/school/page`, params })
  },

  // 查询院校详情
  getSchool: async (id: number) => {
    return await request.get({ url: `/kf/school/get?id=` + id })
  },

  // 新增院校
  createSchool: async (data: SchoolVO) => {
    return await request.post({ url: `/kf/school/create`, data })
  },

  // 修改院校
  updateSchool: async (data: SchoolVO) => {
    return await request.put({ url: `/kf/school/update`, data })
  },

  // 删除院校
  deleteSchool: async (id: number) => {
    return await request.delete({ url: `/kf/school/delete?id=` + id })
  },

  // 导出院校 Excel
  exportSchool: async (params) => {
    return await request.download({ url: `/kf/school/export-excel`, params })
  },

  // 获取所有院校
  getAllSchools: async () => {
    return await request.get({ url: `/kf/school/getAllSchools` })
  },
}
